<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page isELIgnored ="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<title>用户管理-用户列表</title>
<link rel="stylesheet"
	href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"
	integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N"
	crossorigin="anonymous">
<script
	src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
	integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
	crossorigin="anonymous"></script>
<script
	src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"
	integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct"
	crossorigin="anonymous"></script>
</head>
<body>

<nav class="navbar navbar-expand-lg navbar-light bg-light mb-2">
  <a class="navbar-brand" href="${ctx}">首页</a>
 <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
    <div class="navbar-nav">
      <a class="nav-link" href="${ctx}/user/list">用户管理</a>
      <a class="nav-link" href="${ctx}/user/list">菜单管理</a>
      <a class="nav-link active" href="${ctx}/role/list">角色管理</a>
    </div>
</nav>

<nav class="navbar navbar-light bg-light mb-2">
	<a class="btn btn-success" href="${ctx}/roleAdd.jsp" role="button">新增角色</a>
</nav>


<table class="table table-striped">
	<tr align="center" valign="middle">
		<td width="200" >角色名称</td>
		<td width="200">角色权限字符串</td>
		<td width = "200">备注</td>
		<td width="200">操作</td>
	</tr>
	<c:forEach var="role" items="${roles}">
		<tr>
			<td width="200" >${role.role_name }</td>
			<td width="200">${role.role_key }</td>
			<td width = "200">${role.remark }</td>
			<td width="200" align="center">
				<a type="button" class="btn btn-primary" href="${ctx}/role/update?role_id=${role.role_id}">修改</a>
				<a type="button" class="btn btn-danger" href="${ctx}/role/delete?role_id=${role.role_id}&role_name=${role.role_name}">删除</a>
				
				
				<c:choose>
    			<c:when test="${role.status==0}">
				<a type="button" class="btn btn-danger" href="${ctx}/role/status?role_id=${role.role_id}&role_name=${role.role_name}&status=${role.status}">停用</a>
    			</c:when>
    			<c:otherwise>
				<a type="button" class="btn btn-success" href="${ctx}/role/status?role_id=${role.role_id}&role_name=${role.role_name}&status=${role.status}">启用</a>
    			</c:otherwise>
				</c:choose>
			</td>
		</tr>
	</c:forEach>
</table>

</body>
</html>